package com.iverson.nginx.gateway.controller;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class RoleController {

    @PostMapping("/api/role/add")
    public ResponseEntity<String> addRole() {
        // 业务逻辑（已通过Nginx校验）
        return ResponseEntity.ok("Role added successfully");
    }


    @PostMapping("/api/role/add/exception")
    public ResponseEntity<String> addException() {
        // 业务逻辑（已通过Nginx校验）
        try {
            int i = 1 / 0; // 模拟异常，测试Nginx的错误页面配置
            System.out.println(i);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        return ResponseEntity.ok("Role added exception");
    }
}
